package me.chan.chatting.server.service.impl;

import me.chan.chatting.server.service.LoginService;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class LoginServiceImpl implements LoginService {

    private Map<String, String> allUserMap = new ConcurrentHashMap<>();

    {
        allUserMap.put("xiaoming", "123456");
        allUserMap.put("wanger", "123456");
        allUserMap.put("zhangsan", "123456");
        allUserMap.put("lisi", "123456");
        allUserMap.put("liuwu", "123456");
        allUserMap.put("zhaoliu", "123456");
        allUserMap.put("qianqi", "123456");
    }

    @Override
    public boolean login(String username, String password) {
        if ((allUserMap.get(username) != null)) {
            String pwd = allUserMap.get(username);
            return pwd.equals(password);
        }
        return false;
    }
}
